home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 12 / Mac Magazin and MacEasy Magazine CD - Issue 12.iso / Sharewarebibliothek / Anwendungen / Grafik / Matt's_Fract(Fat)101 / Sources / includes / VideoVars.c < prev   
C/C++ Source or Header  |  1995-06-26  |  3KB  |  183 lines

  1. #include "AllTools.h"
  2.  
  3. short            getCursorX(void)
  4. {
  5. return (* (short*) 0x083E);
  6. }
  7.  
  8. short            getCursorY(void)
  9. {
  10. return (* (short*) 0x083C);
  11. }
  12.  
  13. void  setCursorX(short mxValue)
  14. {
  15. (* (short*) 0x083E) = mxValue;
  16. }
  17.  
  18. void  setCursorY(short myValue)
  19. {
  20. (* (short*) 0x083C) = myValue;
  21. }
  22.  
  23. videoInfo GetVideoInfo(void)
  24. {
  25. videoInfo    theScreen;
  26. short        count;
  27.  
  28. theScreen.isVideo = TRUE;
  29. theScreen.screenBase = GetScrnBase();
  30. theScreen.resolutionX = GetScrnWidth();
  31. theScreen.resolutionY = GetScrnHeight();
  32. theScreen.rowBytes = GetScrnRowBytes();
  33. theScreen.bitsPerPixel = GetScrnDepth();
  34. theScreen.screenRect = GetScreenRect();
  35.  
  36. for (count = 0; count < 64; count ++)
  37. {
  38.     theScreen.BitDepthPossible[count] = gotDepth(count);
  39. }
  40.  
  41. return theScreen;
  42. }
  43.  
  44. Ptr                GetScrnBase(void)
  45. {
  46. GDHandle        theGDHandle;
  47. GDevice            theGDDevice;
  48. PixMapHandle    thePixMapHandle;
  49. PixMap            thePixMap;
  50. Ptr                ScrnBase;
  51.  
  52. theGDHandle  = GetTheGDevice();
  53. theGDDevice  = **(theGDHandle);
  54. thePixMapHandle = theGDDevice.gdPMap;
  55. thePixMap = **(thePixMapHandle);
  56. ScrnBase = thePixMap.baseAddr;
  57.  
  58. return ScrnBase;
  59. }
  60.  
  61. short             GetScrnWidth(void)
  62. {
  63. GDHandle        theGDHandle;
  64. GDevice            theGDDevice;
  65. PixMapHandle    thePixMapHandle;
  66. PixMap            thePixMap;    
  67. Rect            theScreenRect;
  68. short            theWidth;
  69.  
  70. theGDHandle  = GetTheGDevice();
  71. theGDDevice  = **(theGDHandle);
  72. thePixMapHandle = theGDDevice.gdPMap;
  73. thePixMap = **(thePixMapHandle);
  74. theScreenRect = thePixMap.bounds;
  75. theWidth = theScreenRect.right - theScreenRect.left;
  76.  
  77. return theWidth;
  78. }
  79.  
  80. short            GetScrnHeight(void)
  81. {
  82. GDHandle        theGDHandle;
  83. GDevice            theGDDevice;
  84. PixMapHandle    thePixMapHandle;
  85. PixMap            thePixMap;    
  86. Rect            theScreenRect;
  87. short            theHeight;
  88.  
  89. theGDHandle  = GetTheGDevice();
  90. theGDDevice  = **(theGDHandle);
  91. thePixMapHandle = theGDDevice.gdPMap;
  92. thePixMap = **(thePixMapHandle);
  93. theScreenRect = thePixMap.bounds;
  94. theHeight = theScreenRect.bottom - theScreenRect.top;
  95.  
  96. return theHeight;
  97. }
  98.  
  99. short             GetScrnDepth(void)
  100. {
  101. GDHandle        theGDHandle;
  102. GDevice            theGDDevice;
  103. PixMapHandle    thePixMapHandle;
  104. PixMap            thePixMap;
  105. short            theDepth;
  106.  
  107. theGDHandle  = GetTheGDevice();
  108. theGDDevice  = **(theGDHandle);
  109. thePixMapHandle = theGDDevice.gdPMap;
  110. thePixMap = **(thePixMapHandle);
  111. theDepth = thePixMap.pixelSize;
  112.  
  113. return theDepth;
  114. }
  115.  
  116. Boolean gotDepth(short count)
  117. {
  118. GDHandle        theGDHandle;
  119. short            theMode;
  120.  
  121. theGDHandle  = GetTheGDevice();
  122.  
  123. theMode = HasDepth(theGDHandle, count, 1, 1);
  124.  
  125. return (theMode > 0);
  126. }
  127.  
  128. short             GetScrnRowBytes(void)
  129. {
  130. GDHandle        theGDHandle;
  131. GDevice            theGDDevice;
  132. PixMapHandle    thePixMapHandle;
  133. PixMap            thePixMap;
  134. short            rowBytes;
  135.  
  136. theGDHandle  = GetTheGDevice();
  137. theGDDevice  = **(theGDHandle);
  138. thePixMapHandle = theGDDevice.gdPMap;
  139. thePixMap = **(thePixMapHandle);
  140. rowBytes = thePixMap.rowBytes;
  141. rowBytes = (rowBytes & 4095);
  142. return rowBytes;
  143. }
  144.  
  145. unsigned char    GetVolume(void)
  146. {
  147. return LMGetSdVolume();
  148. }
  149.  
  150. void             SetVolume(unsigned char SdVolumeValue)
  151. {
  152. LMSetSdVolume(SdVolumeValue);
  153. }
  154.  
  155. StringPtr         GetFinderName(void)
  156. {
  157. return LMGetFinderName();
  158. }
  159.  
  160. void             SetFinderName(StringPtr FinderNameValue)
  161. {
  162. LMSetFinderName(FinderNameValue);
  163. }
  164.  
  165. Ptr                GetTheA5(void)
  166. {
  167. return LMGetCurrentA5();
  168. }
  169.  
  170. void             SetTheA5(Ptr CurrentA5Value)
  171. {
  172. LMSetCurrentA5(CurrentA5Value);
  173. }
  174.  
  175. GDHandle GetTheGDevice(void)
  176. {
  177. return LMGetTheGDevice();
  178. }
  179.  
  180. Rect            GetScreenRect(void)
  181. {
  182.     return qd.screenBits.bounds;
  183. }